import 'package:flutter/material.dart';
import 'package:flutter_bilibili/mock/home_data.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart';

class HiBanner extends StatefulWidget {
  final double height;

  const HiBanner({super.key, this.height = 200});

  @override
  State<HiBanner> createState() => _HiBannerState();
}

class _HiBannerState extends State<HiBanner> {
  final List<String> images = banner_images;

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: widget.height,
      child: Swiper(
        itemBuilder: (context, index) {
          return InkWell(
            onTap: () {
              // todo:预留口子，视频跳转到视频详情，其他类型跳转到H5页面
              print(index);
            },
            child: Image.asset(
              images[index],
              fit: BoxFit.fill,
            ),
          );
        },
        indicatorLayout: PageIndicatorLayout.COLOR,
        autoplay: true,
        itemCount: images.length,
        pagination: const SwiperPagination(alignment: Alignment.bottomRight),
        control: const SwiperControl(),
      ),
    );
  }
}
